package com.xiaoxi.bms.common.exception;

import com.xiaoxi.bms.common.constant.enumeration.statuscode.ParentEnum;

import java.util.Map;

/**
 * 异常处理类
 *
 * @author xiaoxi
 * @version 1.0
 * @date 2022/5/16 14:41
 */
public class BMSException extends Exception {

    private String code;
    private String message;

    public BMSException(String code, String message) {
        super(message);
        this.code = code;
        this.message = message;

    }

    public BMSException(ParentEnum parentEnum) {

        Map<String, String> enumData = parentEnum.format();
        this.code = enumData.get("code");
        this.message = enumData.get("message");

    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    @Override
    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }
}
